#
# Copyright (C) 2015, Broadcom Corporation
# All Rights Reserved.
# 
# This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
# the contents of this file may not be disclosed to third parties, copied
# or duplicated in any form, in whole or in part, without the prior
# written permission of Broadcom Corporation.
#
#
# <<Broadcom-WL-IPTag/Proprietary:>>
#
# $Id: Makefile 520342 2014-12-11 05:39:44Z $
#
include $(BUILDDIR)/vendor/broadcom/default.mk
DIR := $(shell pwd)
TOP := $(shell (cd $(DIR)/.. && pwd -P))

UPNPLIB_NAME = libupnp.so
UPNPLIB = $(BUILDDIR)/vendor/broadcom/libupnp
SRCPATH = $(UPNPLIB)/upnp

INCLUDES += -I$(UPNPLIB)/include -I$(BUILDDIR)/driver/bcmdriver/include/shared -I$(BUILDDIR)/driver/bcmdriver/include -I$(BUILDDIR)/driver/bcmdriver/include/bcmcrypto -I$(BUILDDIR)/vendor/broadcom/shared
CFLAGS += ${INCLUDES}

CFLAGS += -Wall -Wunused -g -s -fPIC #-Werror


LDFLAGS = -L$(TOP)/libbcmcrypto -lbcmcrypto

vpath %.c $(SRCPATH) $(UPNPLIB)/linux
vpath %.o $(UPNPLIB)/prebuilt

SRCFILES = upnp.c upnp_ssdp.c upnp_http.c upnp_gena.c upnp_soap.c \
	upnp_description.c upnp_device.c upnp_util.c upnp_msg.c \
	upnp_linux_osl.c

OBJFILES = ${SRCFILES:.c=.o}

all: $(OBJFILES)
	$(LD) -shared -o $(UPNPLIB_NAME) $^

install: all
	#install -d $(INSTALLDIR)/usr/lib
	install -m 755 $(UPNPLIB_NAME) $(FSROOT)/usr/lib
	$(STRIP) $(FSROOT)/usr/lib/$(UPNPLIB_NAME)

clean:
	rm -f $(UPNPLIB_NAME) $(OBJFILES)

.PHONY: clean
